package com.koron.order.risk.riskDuty.controller;


import com.koron.bean.base.Response;
import com.koron.common.core.config.ThreadLocalContext;
import com.koron.order.risk.riskDuty.bean.po.LineRiskDutyPosition;
import com.koron.order.risk.riskDuty.service.LineRiskDutyPositionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.koron.ebs.mybatis.ADOConnection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 看护值守巡视位置信息(LineRiskDutyPosition)表控制层
 *
 * @author jzp
 * @since 2022-12-28 17:56:39
 */
@Api(tags = "风险看护值守单-巡视位置信息接口")
@RestController
@RequestMapping("lineRiskDutyPosition")
public class LineRiskDutyPositionController {
    /**
     * 服务对象
     */
    @Autowired
    private LineRiskDutyPositionService lineRiskDutyPositionService;

    private String getCurrDs() {
        return ThreadLocalContext.get().getCurrDs();
    }

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @ApiOperation(value = "根据id查询")
    @GetMapping
    public Response<LineRiskDutyPosition> selectOne(@RequestParam String id) {
        return Response.ok(ADOConnection.runTask(getCurrDs(), lineRiskDutyPositionService, "getById", LineRiskDutyPosition.class, id));
    }

    @ApiOperation(value = "列表查询")
    @GetMapping("list")
    public Response<List<LineRiskDutyPosition>> list(LineRiskDutyPosition query) {
        return Response.ok(ADOConnection.runTask(getCurrDs(), lineRiskDutyPositionService, "list", List.class, query));
    }

}

